package com.ofc.chart.builder;

import com.ofc.chart.engine.IChartJsonBuilder;
import com.ofc.chart.model.Bar3D;

/**
 * Bar3D Chart Json对象构建类
 * 
 * @author zhangpeng
 * @date 2012-12-6
 */
public class Bar3dJsonBuilder implements IChartJsonBuilder {
	private ElementBuilder elementBuilder = new ElementBuilder();
	private Bar3D bar3D;

	@Override
	public String buildJson() {
		StringBuffer json = new StringBuffer("{");
		String titleJson = elementBuilder.buildTitle(bar3D.getTitle());
		String ylegendJson = elementBuilder.buildYLegend(bar3D.getYlegend());
		String xaxisJson = elementBuilder.buildXAxis(bar3D.getXaxis());
		String yaxisJson = elementBuilder.buildYAxis(bar3D.getYaxis());
		String elementsJson = elementBuilder.buildElements(bar3D.getElements());
		json.append(titleJson + ",");
		json.append(ylegendJson + ",");
		json.append(xaxisJson + ",");
		json.append(yaxisJson + ",");
		json.append(elementsJson);
		json.append("}");
		return json.toString();
	}

	public Bar3dJsonBuilder(Bar3D bar3D) {
		this.bar3D = bar3D;
	}
}
